home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v7n21.arc / WS4XLATE.C < prev   
Text File  |  1988-11-14  |  741b  |  27 lines

  1. /* WS4XLATE.C
  2.     To compile: cl ws4xlate.c
  3.     or          tcc ws4xlate
  4. */
  5.  
  6. #include<stdio.h>
  7. #define LEADIN      0x1b            /* Esc lead in */
  8. #define LEADOUT     0x1c            /* Esc lead out */
  9. #define EXTENDED    0x80            /* extended char mask: 10000000 */
  10.  
  11. void main ()
  12. {
  13.     int c;
  14.  
  15.     while( (c = getchar()) != EOF)  /* get characters from input */
  16.     {
  17.         if(c & EXTENDED)            /* if high bit is set    */
  18.         {                           /* embed it in escape chars */
  19.             putchar(LEADIN);
  20.             putchar(c);
  21.             putchar(LEADOUT);
  22.         }
  23.         else                        
  24.             putchar(c);             /* put to output             */
  25.     }
  26. }
  27.